import Cookies from "js-cookie";
import {ref} from "vue";

const TokenKey = 'TokenKey_token_Shop'

export function getToken() {
    return Cookies.get(TokenKey)
}

export function setToken(token: string) {
    return Cookies.set(TokenKey, token)
}

export function removeToken() {
    return Cookies.remove(TokenKey)
}

const RefreshKey = 'RefreshKey_token_Shop'

export function getRefreshToken() {
    return Cookies.get(RefreshKey)
}

export function setRefreshToken(refreshToken: string) {
    return Cookies.set(RefreshKey, refreshToken)
}

export function removeRefreshToken() {
    return Cookies.remove(RefreshKey)
}




export function getUnitText(unit:any) {
    // You can customize this method to display meaningful status text
    switch (unit.toString()) {//0天 1周(七天) 2月(30天) 3年(365天)
        case '0':
            return '天';
        case '1':
            return '周(七天)';
        case '2':
            return '月(30天)';
        case '3':
            return '年(365天)';
        default:
            return '未知状态';
    }
}

export function getLendText(status:any) {
    // You can customize this method to display meaningful status text
    switch (status.toString()) {//0待租 1有人想要 2已租出
        case '0':
            return '待租';
        case '1':
            return '锁定';
        case '2':
            return '租出';
        default:
            return '未知';
    }
}

export function getAgreeText(status:any) {
    // You can customize this method to display meaningful status text
    switch (status.toString()) {//状态 0开始 1进行中 2归还 3完成
        case '0':
            return '想要';
        case '1':
            return '进行中';
        case '2':
            return '归还';
        case '3':
            return '完成';
        default:
            return '未知';
    }
}

